return;
for ( i = 0; i < size; i += clflush_size )
- clflush((char *)addr + i);
+ cacheline_flush((char *)addr + i);
}
void iommu_flush_cache_entry(void *addr)
struct acpi_drhd_unit *drhd;
struct iommu *iommu;
- wbinvd();
+ flush_all_cache();
for_each_drhd_unit ( drhd )
{
iommu = drhd->iommu;
return -ENOMEM;
}
- set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, drhd->address);
- iommu->reg = (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus);
+ iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address);
iommu->index = nr_iommus++;
iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG);
return -ENODEV;
spin_lock_init(&domid_bitmap_lock);
- clflush_size = get_clflush_size();
+ clflush_size = get_cache_line_size();
for_each_drhd_unit ( drhd )
if ( iommu_alloc(drhd) != 0 )
u32 data; /* msi message data */
};
-unsigned int get_clflush_size(void);
+unsigned int get_cache_line_size(void);
+void cacheline_flush(char *);
+void flush_all_cache(void);
+void *map_to_nocache_virt(int nr_iommus, u64 maddr);
u64 alloc_pgtable_maddr(void);
void free_pgtable_maddr(u64 maddr);
void *map_vtd_domain_page(u64 maddr);
free_domheap_page(maddr_to_page(maddr));
}
-unsigned int get_clflush_size(void)
+unsigned int get_cache_line_size(void)
{
return ((cpuid_ebx(1) >> 8) & 0xff) * 8;
}
+void cacheline_flush(char * addr)
+{
+ clflush(addr);
+}
+
+void flush_all_cache()
+{
+ wbinvd();
+}
+
+void *map_to_nocache_virt(int nr_iommus, u64 maddr)
+{
+ set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, maddr);
+ return (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus);
+}
+
struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain)
{
if ( !domain )